define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, undefined, Frontend, Form, Template) {
     var validatoroptions = {
        invalid: function (form, errors) {
            $.each(errors, function (i, j) {
                Layer.msg(j);
            });
        }
    };
    var Controller = {
        moneyin:function(){
            $("#moneyin").data("validator-options", validatoroptions);

              Form.api.bindevent($("#moneyin"), function (data, ret) {
                setTimeout(function () {
                    location.href = ret.url ? ret.url : "/";
                }, 1000);
              });
          
        },
        moneyout:function(){
            $("#moneyout").data("validator-options", validatoroptions);

              Form.api.bindevent($("#moneyout"), function (data, ret) {
                setTimeout(function () {
                    location.href = ret.url ? ret.url : "/";
                }, 1000);
              });
        },
        pointtopoint:function(){
           $("#pointtopoint").data("validator-options", validatoroptions);

              Form.api.bindevent($("#pointtopoint"), function (data, ret) {
                setTimeout(function () {
                    location.href = ret.url ? ret.url : "/";
                }, 1000);
              });
           
            $('#query').on('click', function() {
                     var username=$('#username').val();
                     var mobile=$('#mobile').val();
                     $.post('inout/getUserBaseInfo',{username:username},function(rsp){
                        layer.closeAll();
                        layer.msg(rsp.msg, {
                          offset: 'auto',
                          anim: 6,
                          end:function(){
                           
                          }
                        });
                        if (rsp.code==0) {

                          var mobile=$('#mobile').val(rsp.msg);
                        }else{
                           layer.msg('成功')
                          var mobile=$('#mobile').val(rsp);
                       } 
                    })
            });  
        },
        selfbuy:function(){
            $("#selfbuy").data("validator-options", validatoroptions);

              Form.api.bindevent($("#selfbuy"), function (data, ret) {
                setTimeout(function () {
                    location.href = ret.url ? ret.url : "/";
                }, 1000);
              });
        },
        selfsell:function(){
            $("#selfsell").data("validator-options", validatoroptions);

              Form.api.bindevent($("#selfsell"), function (data, ret) {
                setTimeout(function () {
                    location.href = ret.url ? ret.url : "/";
                }, 1000);
              });
        }
       
    };
    return Controller;
});